home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 001-025 / scopedisk15 / qrt / docs / user.doc < prev    next >
Text File  |  1995-03-18  |  36KB  |  991 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.         
  8.         
  9.                                 QRT Users Manual
  10.         
  11.         
  12.         INTRODUCTION
  13.         
  14.         QRT (Quick Ray Tracer) is an easy  to use image generation system
  15.         that uses a ray tracing algorithm  for image rendering.  Versions
  16.         exist for the Amiga personal  computer  and Data General MV10000.
  17.         QRT overcomes many of the problems of other ray tracing packages,
  18.         and is designed to operate nicely in a multi-tasking environment.
  19.         
  20.         
  21.         COMPARISON TO OTHER SYSTEMS
  22.         
  23.         QRT was developed on the Amiga  personal  computer, so it will be
  24.         compared to other Amiga ray tracers.  There are, to my knowledge,
  25.         five other Amiga ray  tracers,  each  with  its own strengths and
  26.         weaknesses.  I will describe each  system briefly, and compare it
  27.         to QRT.  All the  Amiga  ray  tracers  can  operate  in HAM (4096
  28.         color) mode.
  29.         
  30.            RT: RT was the first ray tracer written for the Amiga, by Eric
  31.                Graham.  It will model a universe  made of only spheres, a
  32.                sky, and a checkered or  solid  ground.   It is relatively
  33.                fast, but not  generally  useful  for  realistic  modeling
  34.                because of the sphere  limitation.   The input language is
  35.                cryptic, although some error checking is done.  The system
  36.                will only generate low resolution images.
  37.         
  38.           SILVER: I have never seen  SILVER,  so  I cannot say much about
  39.                this system.
  40.         
  41.           SCULPT-3D: This package incorporates  an interactive editor for
  42.                creating objects, and is  capable  of quickly generating a
  43.                preliminary image of  the  scene  by  using hidden surface
  44.                techniques.  However, every primitive is made of polygons,
  45.                and some primitives such as  spheres  require  hundreds of
  46.                polygons for a smooth texture,  so the ray tracing is very
  47.                slow.  Also, the package takes a large amount of memory to
  48.                run, and is prone to system crashes.  Its chief feature is
  49.                the ability to  create  arbitrary  shaped  objects using a
  50.                series of triangles.  Mirrored, dull, or shiny objects are
  51.                supported.
  52.         
  53.           CLIGHT: This ray tracer  also  has  an  interactive editor, but
  54.                produces very poor quality  images.   It is not capable of
  55.                any patterning or reflection characteristics.
  56.         
  57.  
  58.  
  59.  
  60.         QRT Ray Tracer               Page 1                   User Manual
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.           DBW: This is possibly the  most  complete  ray  tracer  for the
  74.                Amiga.  It will support objects  with arbitrary degrees of
  75.                reflection  and  gloss,   depth  of  field  effects,  some
  76.                texturing, wavy surfaces, fractals,  transparent surfaces,
  77.                diffuse propagation of light from  object to object, and 5
  78.                primitive types (sphere, triangle, parallelogram, fractal,
  79.                and ring).  The input language,  however, is so cryptic as
  80.                to be nearly  incomprehensible,  and if there is any error
  81.                in the input file, it will  crash  the system.  It is also
  82.                painfully  slow;  some  images  take  16  to  24  hours to
  83.                complete.
  84.         
  85.         QRT is meant to be  a  compromise  between  the  fast, simple ray
  86.         tracers and the slow powerful systems.   It compares favorably in
  87.         speed to RT, and in power  to  Sculpt-3d  or  DBW.  It has a very
  88.         friendly input language with extensive  error checking.  Here are
  89.         some features of QRT:
  90.         
  91.             o  Multiple primitive types, including user defined quadratic
  92.                surfaces
  93.         
  94.             o  Arbitrary   levels   of   diffuse   reflection,   spectral
  95.                reflection, transmission, ambient lighting, and gloss
  96.         
  97.             o  User defined pattern information for objects
  98.         
  99.             o  Bounding boxes for groups of objects
  100.         
  101.             o  Shadows
  102.         
  103.             o  Multiple light sources with different characteristics
  104.         
  105.             o  Arbitrary Phong spectral reflection coefficients
  106.         
  107.             o  Color dithering to increase the apparent number of colors
  108.         
  109.             o  Easy  to  use,  free  format  input  language  with  error
  110.                checking.  Parameters are by keyword and may appear in any
  111.                order.
  112.         
  113.             o  Supports medium resolution (128k dots/screen)
  114.         
  115.         Each of these features of QRT will be discussed is greater detail
  116.         in this document.
  117.         
  118.         
  119.         
  120.         THE QRT WORLD
  121.         
  122.         QRT constructs an  image  of  the  world  by  performing  certain
  123.         manipulations  on  an  internal  representation  of  a  group  of
  124.  
  125.  
  126.         QRT Ray Tracer               Page 2                   User Manual
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.         objects.  You must provide a description  of these objects to QRT
  140.         through the QRT input language.
  141.         
  142.         QRT writes a machine independent bitmap file which can be read by 
  143.         a computer specific post  processor.   The  post processor either
  144.         displays the  image  or  converts  it  into  the  proper form for
  145.         display  by  system   programs.     (See  the  Machine  Dependent
  146.         Information section of this manual for details).
  147.         
  148.         QRT is capable of dealing  with  5  types  of  primitive objects:
  149.         spheres,   parallelograms,   triangles,   rings   (annulus),  and
  150.         quadratic  surfaces.   The  latter  can  be  used to model cones,
  151.         oblong spheroids, and other interesting  surfaces.  Each of these
  152.         objects can have an arbitrary orientation in space, and arbitrary
  153.         surface characteristics.
  154.         
  155.         
  156.         
  157.         QRT INPUT LANGUAGE
  158.         
  159.         The QRT input language is free  format,  in  that commands may be
  160.         placed anywhere on a line,  and  newlines  may  be  placed at any
  161.         point.  This makes it easy to use indentation.  Comments are also
  162.         supported by surrounding  text  with  curly  braces  '{' and '}'.
  163.         Comments may span lines.
  164.         
  165.         Once a file with QRT commands is built  (using any available text
  166.         editor), qrt can be made to process these commands:
  167.         
  168.             QRT <commands.qrt
  169.         
  170.         where "commands.qrt" is the file containing  the input.  QRT also
  171.         produces some statistics, so this  output can also be redirected.
  172.         Since QRT runs for a long time, you  will probably want to run it
  173.         as a background task with a low  priority.   So,  the full set of
  174.         commands to run QRT would be:
  175.         
  176.             SetTaskPriority -5
  177.             run QRT <commands.qrt >qrt.out
  178.             SetTaskPriority 0
  179.         
  180.         This set of commands is specific to  the Commodore Amiga; see the
  181.         Machine Dependent  Information  section  of  the manual for other
  182.         operating systems.
  183.         
  184.         QRT will write a very large file, which may be anywhere from 400K 
  185.         to  4  megabytes  depending  on  the  specific  computer  display
  186.         resolution.  (See the Machine  Dependent  Information  section of
  187.         this manual for the exact file  size).   There should be at least
  188.         enough room on your disk to  accommodate  this  file. I recommend
  189.         sending the output to a RAM disk,  so that the physical disk does
  190.  
  191.  
  192.         QRT Ray Tracer               Page 3                   User Manual
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.         not get used for 60 minutes while QRT computes the image.
  206.         
  207.         A typical QRT  command  to  create  a  sphere  using  the default
  208.         surface attributes would, be:
  209.         
  210.             SPHERE ( loc = (5,10,100)     { this is a white sphere }
  211.                      radius = 12.5
  212.                    )
  213.         
  214.         For comparison, the sphere command for DBW looks like this:
  215.         
  216.             s 0 0 0 1 0 0 0 .2 .2 .2 .8 .8 .8 5 10 100 12.5
  217.         
  218.         Or, in RT, the command would be:
  219.         
  220.             <1,1,1> 2 (5,10,100):1;
  221.         
  222.         The QRT input should be much  easier  to understand.  If QRT sees
  223.         an error in its  input  file,  it  will  stop  and print the line
  224.         number of the offending  line,  along  with  a  descriptive error
  225.         message (ILLEGAL PARAMETER, etc).
  226.         
  227.         The QRT input language is not case sensitive.  A full description
  228.         of the language and a shorter, context  free grammar can be found
  229.         elsewhere in this manual.
  230.         
  231.         
  232.         
  233.         THE QRT ILLUMINATION MODEL
  234.         
  235.         Before meaningful images  can  be  created,  the QRT illumination
  236.         model must be understood.  The  light  that  reaches the observer
  237.         from each object is composed of several components:
  238.         
  239.            o  Diffuse light      - The "color" of the object
  240.         
  241.            o  Ambient light      - The color of the light that falls on
  242.                                    the surface of the object if no lamps
  243.                                    are shining on this spot.  Note that
  244.                                    this specifies the color of light, not
  245.                                    the color of the object itself.
  246.         
  247.            o  Reflected light    - If the object acts as a mirror, some
  248.                                    light is reflected.
  249.         
  250.            o  Specular highlights - The "bright spots" of a shiny object
  251.                                    viewed in a light.
  252.         
  253.            o  Transmitted light  - The object may transmit some of the
  254.                                    light that strikes the back of the
  255.                                    object (glass surfaces)
  256.  
  257.  
  258.         QRT Ray Tracer               Page 4                   User Manual
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.         
  272.         All of  these  light  characteristics  can  be  specified for any
  273.         object.  If none are specified, the current defaults are assumed.
  274.         These defaults can be changed (see  DEFAULT in Language Reference
  275.         Guide).
  276.         
  277.         Most of these  light  characteristics  deal  with a percentage of
  278.         light.  For example, a  light  may  reflect  80% of the red light
  279.         that strikes it, 20% of the green,  and 40% of the blue.  This is
  280.         the "color" of the object (diffuse light), and would be specified
  281.         in QRT by the following syntax:
  282.         
  283.                       diff = (.80, .20, .40)
  284.         
  285.         In QRT, 1.00 is 100%.  The  language  is also free-format, so the
  286.         above is equivalent to:
  287.         
  288.                       diff = (.80,
  289.                               .20,
  290.                               .40 )
  291.         
  292.         The commas between parameters  are  optional,  but make the input
  293.         easier to read.  Semicolons can also be used.
  294.         
  295.         Ambient light is specified in a similar manner:
  296.         
  297.                       amb = (.20, .20, .20)
  298.         
  299.         The ambient light  values  should  be  fairly small.  Most of the
  300.         light hitting the object comes from  lamps, but some parts of the
  301.         object may be in the shadow  of  another  object.   If no ambient
  302.         light is specified,  these  shadows  will  appear  totally black,
  303.         which looks unrealistic.  Ambient light will give the affect of a
  304.         small amount of light hitting areas in a shadow, producing a more
  305.         realistic looking image.
  306.         
  307.         Reflection is specified using the MIRROR attribute:
  308.         
  309.                       mirror = (.90, .90, .90)
  310.         
  311.         If a true mirrored surface is  desired,  the mirror values should
  312.         be fairly high.  If one of the values has a higher value than the
  313.         others, the mirror will appear red, green, or blue.
  314.         
  315.         Transmission is specified as follows:
  316.         
  317.                       trans = (.80, .80, .80)
  318.                       index = 120
  319.         
  320.         Note the addition of another parameter,  the index of refraction.
  321.         An explanation of the index of refraction for an object is beyond
  322.  
  323.  
  324.         QRT Ray Tracer               Page 5                   User Manual
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.         the scope of this document - see a  book on elementary optics for
  338.         details.
  339.         
  340.         In  addition,   specular   highlights   are  specified  with  two
  341.         parameters:
  342.         
  343.                       reflect  = .50,
  344.                       sreflect = 45
  345.         
  346.         "REFLECT" is the percentage of  light  reflected  in the specular
  347.         highlight,  and  sreflect   is   the  Phong  spectral  reflection
  348.         coefficient.  Again, an  explanation  of the Phong coefficient is
  349.         beyond the scope of this  document;  however,  a higher value for
  350.         the coefficient will result in smaller,  tighter highlights for a
  351.         more metallic looking object.  Lower values of sreflect should be
  352.         accompanied by lower values in  reflect,  and will produce duller
  353.         looking surfaces, such as paper.
  354.         
  355.         QRT also accepts a dithering amount for each object:
  356.         
  357.                       dither = 3
  358.         
  359.         Dithering is a mechanism for  simulating  colors not available on
  360.         the display by blending  other  colors.   The  default  dithering
  361.         coefficient is 3; it should be kept  small.  Values of 1 to 6 are
  362.         good.  Larger objects should employ  more dithering, and mirrored
  363.         or glass objects should have little or no dithering.
  364.         
  365.         QRT also accepts an attribute "FUZZ", but this is not used in the
  366.         present implementation.  In a future  implementation of QRT, FUZZ
  367.         will effect small, random perturbations of the normal vector at a
  368.         given location on an object.  This  will simulate rough surfaces,
  369.         matted glass, or imperfectly reflecting mirrors.
  370.         
  371.         All of the above  light  characteristics  may  be attached to any
  372.         object.   The  default  is  for  a  white,  non  reflecting,  non
  373.         transmitting dull surface with an average amount of dithering. In
  374.         addition, any of  the  above  color  information  (which  will be
  375.         referred to from now on as  COLORINFO)  may also be attached to a
  376.         pattern structure (see the PATTERN section of this document).
  377.         
  378.         
  379.         
  380.         LIGHT SOURCES
  381.         
  382.         Light sources in QRT are called  "LAMPS".   The lamp structure is
  383.         simple:
  384.         
  385.                      LAMP ( loc = (12, 34, 56),
  386.                             dist = 50,
  387.                             radius = 10 )
  388.  
  389.  
  390.         QRT Ray Tracer               Page 6                   User Manual
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.         
  404.         The default is for a bright white lamp, but if you wish to change
  405.         this, you can  specify  different  values  for the lamp's ambient
  406.         light.  The radius value  is  ignored  by  this implementation of
  407.         QRT, but it must be supplied.   In  a  future version, the radius
  408.         may be used to  implement  penumbral  shadows.   I didn't include
  409.         them in  this  version,  since  they  take  a  very  long time to
  410.         compute, and don't add much to the image quality.
  411.         
  412.         The "dist" entry in the lamp structure specifies at what distance
  413.         the light from the lamp is at full intensity.  Beyond this value,
  414.         the light will decrease in  intensity.   This value should be set
  415.         so that the nearest object  in  the  scene  is slightly more than
  416.         "dist" distance units from the  lamp.   This  does not have to be
  417.         exact. If objects are nearer  than  dist"  units, they will be so
  418.         bright that shading will not  take  place.  Objects very far away
  419.         will be dimly illuminated.
  420.         
  421.         By the way, QRT distance  units  are  not  tied to any real world
  422.         unit.  They can stand for feet,  nautical  miles, or furlongs, at
  423.         your choice.
  424.         
  425.         
  426.         
  427.         THE OBSERVER
  428.         
  429.         After defining the world,  you  must  tell  QRT  the position and
  430.         orientation of the observer.  This is done as follows:
  431.         
  432.                  OBSERVER ( loc     = (0, 10,  20),
  433.                             lookat  = (5,  5, 120),
  434.                             up      = (0,  1,   0)
  435.                           )
  436.         
  437.         The x,y, and z are the location  of  the  observer.  The "lookat"
  438.         variables give a location in  space  that the observer is looking
  439.         at.  Most ray tracers  require  you  to  give  two angles for the
  440.         observers view  direction,  but  it  is  MUCH  easier to know the
  441.         location of an object or point in  space you wish the observer to
  442.         look at.  This will be the center of your scene.
  443.         
  444.         The "up" variables define which  direction  is  up.  Usually, you
  445.         will wish to use the values  given  above.  QRT uses a right hand
  446.         coordinate system: positive  y  is  up,  positive z is out of the
  447.         screen, and positive x is to the right  if you are looking in the
  448.         negative z direction.   The  "up"  parameter  is optional, and if
  449.         omitted, defaults to (0,1,0).
  450.         
  451.         QRT will generate an error message if no observer is defined.
  452.         
  453.         
  454.  
  455.  
  456.         QRT Ray Tracer               Page 7                   User Manual
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.         
  470.         OUTPUT FILENAME
  471.         
  472.         QRT places its output in a file, so  you must give it the name of
  473.         this file:
  474.         
  475.                       FILE_NAME = outfile.tmp
  476.         
  477.         This file must  observe  any  file  naming  restrictions  of  the
  478.         operating system and  computer  you  are  using.  See the Machine
  479.         Dependent Information section  of  this manual for information on
  480.         file naming restrictions.
  481.         
  482.         
  483.         
  484.         FOCAL LENGTH
  485.         
  486.         This is the focal length  of  the  "lens"  used  by the observer.
  487.         Think of it as a 35mm  camera  lens  -  higher  numbers produce a
  488.         telephoto effect, and smaller numbers  are for wide angle lenses.
  489.         Note that small numbers may produce some distortion of the  image
  490.         around the edges.
  491.         
  492.                       FOC_LENGTH = 60
  493.         
  494.         
  495.         
  496.         SCAN RANGE
  497.         
  498.         If you do not want QRT to produce  a whole image, you can specify
  499.         the first and last scan  lines.    The  parameters should be less
  500.         than the maximum Y resolution of your display.
  501.         
  502.                       FIRST_SCAN = 100
  503.                       LAST_SCAN  = 300
  504.         
  505.         This is useful for quickly generating part of an image.
  506.         
  507.         
  508.         
  509.         SKY AND GROUND
  510.         
  511.         QRT has facilities for generating  the sky and ground.  To define
  512.         the sky, you must give it two  colors  - one for the sky overhead
  513.         (zenith), and one for the horizon:
  514.         
  515.                       SKY ( zenith  = (.10, .2, .4),
  516.                             horiz   = (.10, .2, .65),
  517.                             dither   = 6
  518.                       )
  519.         
  520.  
  521.  
  522.         QRT Ray Tracer               Page 8                   User Manual
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.         This will produce a blue  sky,  with  a  brighter  color near the
  536.         horizon.  (The sky need not  be  blue  -  it  could be red or hot
  537.         pink, or vary from red to  green).   QRT  will smoothly blend the
  538.         colors from the zenith  to  the  horizon.   Since  the  sky is so
  539.         large, you may want to specify  a  greater amount of dithering to
  540.         compensate for the displays color resolution limit.
  541.         
  542.         The SKY structure will also produce sky colors below the horizon;
  543.         any ray that does not strike an  object  will strike the SKY.  To
  544.         fix this, define a ground.  There is no dedicated GROUND command,
  545.         since you can define a  very  large  parallelogram  with the same
  546.         effect.  You can make it  brown  with  patches  of  green using a
  547.         PATTERN, or checkered green and yellow in the classic ray-tracing
  548.         ground pattern.
  549.         
  550.         
  551.         
  552.         BOUNDING BOXES
  553.         
  554.         QRT supports the use of  bounding  boxes to speed the ray tracing
  555.         process.  For images  composed  of  only  a few (1 to 3) objects,
  556.         bounding boxes will not do much to  increase speed.  However, for
  557.         images where there are groups of objects physically close to each
  558.         other, they can greatly reduce  execution  times.  A bounding box
  559.         is a conceptual structure that encloses a group of objects.  When
  560.         the ray tracer is finding  line/object  intersections,  if a line
  561.         does not strike a  bounding  box,  it  cannot possibly strike any
  562.         objects within that bounding box.   This saves the ray tracer the
  563.         trouble of  checking  intersections  with  all objects within the
  564.         box.  In the  case  where  the  ray  DOES  enter  the  box,  some
  565.         additional overhead  is  incurred;  however,  this cost is easily
  566.         justified by reduced times for negative tests.
  567.         
  568.         Bounding boxes can occasionally  be  useful  for complex objects,
  569.         such as quadratic  surfaces,  when  the  object  is fairly small.
  570.         Since the time to find the intersection  with a quadratic surface
  571.         is large, but bounding box intersections are fast, the ray tracer
  572.         can save time for all the negative tests.
  573.         
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.         QRT Ray Tracer               Page 9                   User Manual
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.         Bounding boxes can contain  other  bounding boxes, in a recursive
  602.         manner.  This recursive structure defines an "object tree". There
  603.         are two keywords that define the beginning  and end of a bounding
  604.         box: BEGIN_BBOX and END_BBOX.  Here is an example:
  605.         
  606.         
  607.             { ** QRT Code for a chessman ** }
  608.         
  609.             BEGIN_BBOX
  610.         
  611.                 QUADRATIC (  { ** quadr defn ** }
  612.                           )
  613.         
  614.                 QUADRATIC (  { ** quadr defn 2 ** }
  615.                           )
  616.         
  617.                 SPHERE    (  { ** sphere defn ** }
  618.                           )
  619.         
  620.                 BEGIN_BBOX
  621.         
  622.                     SPHERE ( )    { ** two spheres ** }
  623.                     SPHERE ( )
  624.         
  625.                 END_BBOX
  626.         
  627.             END_BBOX
  628.         
  629.         This structure may be nested to an  arbitrary level; if you had a
  630.         closely spaced group of  chessmen,  you could enclose all of them
  631.         with a bounding box.
  632.         
  633.         
  634.         
  635.         PATTERNS
  636.         
  637.         QRT permits user  defined  patterns  which  can  be mapped to the
  638.         surface of any  object.   A  pattern  is  basically  an organized
  639.         method for changing  an  object's  COLORINFO  over the surface of
  640.         that object.  For example, a checkered surface can be created, or
  641.         a surface given the  appearance  of  brick  or tile.  The current
  642.         patterning in QRT is  limited,  yet  powerful  enough to describe
  643.         many common patterns.
  644.         
  645.         A  pattern  is  composed  of  a  series  of  sub-patterns.   Each
  646.         sub-pattern defines a region on  the  surface  of an object which
  647.         will contain a  given  COLORINFO.   These  regions  are presently
  648.         limited to  rectangles,  but  this  may  be  expanded in a future
  649.         implementation of QRT.
  650.         
  651.  
  652.  
  653.  
  654.         QRT Ray Tracer               Page 10                  User Manual
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.         A pattern can be defined once,  and  used  for many objects.  For
  668.         example, a brick pattern might be defined:
  669.         
  670.                   PATTERN ( name = BRICK,
  671.                             { ** other pattern info here ** }
  672.                           )
  673.         
  674.                   SPHERE  ( { ** sphere definition ** }
  675.                             pattern = BRICK
  676.                           )
  677.         
  678.                   PARALLELOGRAM ( { ** parallelogram definition ** }
  679.                                   pattern = BRICK
  680.                                 )
  681.         
  682.         This example ignores what is  actually  in the pattern definition
  683.         to demonstrate how patterns are  attached  to objects.  A pattern
  684.         must be defined before it can be used.   It is given a name, such
  685.         as BRICK, and any object can specify this pattern with "PATTERN =
  686.         BRICK".  There are  no  practical  restrictions  on the length of
  687.         pattern names (if your computer has 1 megabyte of ram, you cannot
  688.         have a pattern name longer than 1  million characters).  Multiple
  689.         patterns may be defined at the top of an input file, and used for
  690.         any object in the file.
  691.         
  692.         What exactly makes  up  a  pattern,  you  ask?   A pattern can be
  693.         viewed as a rectangle that  is  repeated  over  the surface of an
  694.         object.  If the pattern size is  10  x 10, and you have an object
  695.         (say a parallelogram) that is 50 x  50, the pattern will repeat 5
  696.         times in each direction.   Within  this  repeating rectangle, sub
  697.         patterns can be defined.  A sub-pattern  is a rectangle or circle
  698.         within the pattern rectangle with a certain COLORINFO. Any number
  699.         of  these  sub-patterns   can   be  created  within  one  pattern
  700.         definition. To create a  brick  wall,  you  might  define several
  701.         sub-patterns, each with  a  slightly  different  color  of red or
  702.         brown.  The sub  patterns  need  not  cover  the  entire  pattern
  703.         rectangle; if they do not,  the  COLORINFO  you  defined  for the
  704.         object is used instead of the pattern  COLORINFO.  If you defined
  705.         sub-patterns for bricks, the  area  not  covered would be mortar,
  706.         and the objects COLORINFO would  define  the color of the mortar.
  707.         An actual brick pattern is  given  in appendix C.  The proper use
  708.         of patterns can be very effective  in producing realistic looking
  709.         scenes.  However, complicated patterns  will slow image creation,
  710.         so it is recommended that you  first  display test scenes with no
  711.         patterns, and then add  pattern  information  when  the  scene is
  712.         right.
  713.         
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.         QRT Ray Tracer               Page 11                  User Manual
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.         INSTANCES
  734.         
  735.         Often, several copies  of  a  complex  object  must  be  created.
  736.         Specifying  their  component   primitives   each  time  would  be
  737.         difficult. There is a solution to both these problems: INSTANCES.
  738.         An INSTANCE is a method by which several primitives (actually, an
  739.         arbitrary object tree) can be  grouped  and given a name.  Copies
  740.         of these objects may be easily created with one command.  Here is
  741.         an example of an instance definition.
  742.         
  743.                 BEGIN_INSTANCES
  744.         
  745.                     NAME = object1
  746.                     BEGIN_BBOX
  747.                         { ** a bunch of primitives here ** }
  748.                     END_BBOX
  749.         
  750.                     NAME = object2
  751.                     BEGIN_BBOX
  752.                         { ** a bunch more primitives  here ** }
  753.         
  754.                         NAME = spheres
  755.                         BEGIN_BBOX
  756.                           SPHERE ( )  { ** two sphere definitions ** }
  757.                           SPHERE ( )
  758.                         END_BBOX
  759.         
  760.                     END_BBOX
  761.         
  762.                 END_INSTANCES
  763.         
  764.         There can be only one of these instance  definitions, and it must
  765.         appear before any  instances  are  used.   However, any arbitrary
  766.         object tree can appear within the  begin/end instance statements.
  767.         Several instances are now available for use.  For example:
  768.         
  769.                 INSTANCE_OF (  name = object1,
  770.                                loc  = (100, 10, 20),
  771.                             )
  772.         
  773.                 INSTANCE_OF (  name = spheres,
  774.                                loc  = (12.3, 24.5, 999)
  775.                             )
  776.         
  777.         This example shows that any  named  portion of the object subtree
  778.         can function as an instance  (the  "spheres" object is at a lower
  779.         level than the "object1'  object).   The  "offset" parameters are
  780.         required.  They specify a new  position  for the instance (offset
  781.         from the  origin).   In  the  instance  definition  segment,  all
  782.         objects are defined relative to 0,0,0.  They can then be moved in
  783.         the INSTANCE_OF statement with the offset command.
  784.  
  785.  
  786.         QRT Ray Tracer               Page 12                  User Manual
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.         
  800.         In addition, the instance can be given a new size:
  801.         
  802.                 INSTANCE_OF (  name    = object2,
  803.         
  804.                                loc     = (200, 100, 50),
  805.                                scale   = (1.5, 2.0, .25)
  806.                             )
  807.         
  808.         The scale factors are optional,  and  are given the default of 1.
  809.         The instance will be resized by  the  indicated amount in each of
  810.         the directions.  Note that  there  are some restrictions to this:
  811.         if spheres are given a different scale  factor in each direction,
  812.         they will remain spheres (not  change  to  QUADRATIC types).  The
  813.         new radius will be the old  radius  scaled by the smallest of the
  814.         scale factors.
  815.         
  816.         
  817.         
  818.         DEFAULTS
  819.         
  820.         Each object  in  QRT  is  given  certain  default  surface  light
  821.         characteristics (see the section on surface characteristics).  If
  822.         these defaults are  not  suitable,  they  can be changed with the
  823.         DEFAULT command:
  824.         
  825.                 DEFAULT ( diff = (1.00, .1, .1)
  826.                           no_shadow )
  827.         
  828.         This will make all future objects red unless specified otherwise.
  829.         More than one default  command  can  be  used in a file: each one
  830.         affects all the  objects  created  after  it, but before the next
  831.         default  command.   Any  light  characteristics  can  be  changed
  832.         (MIRROR, DITHER, etc).
  833.         
  834.         In addition, the keyword "no_shadow"  can be included (as above).
  835.         Ordinarily, QRT computes shadow information for all objects. This
  836.         takes a lot  of  time,  especially  for  scenes  composed of many
  837.         objects and many lamps.  The  "no_shadow"  command  causes QRT to
  838.         bypass the shadow routines.   This  will  result in a much faster
  839.         image  generation  time,   but  the  picture  will  not  look  as
  840.         realistic.
  841.         
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.         QRT Ray Tracer               Page 13                  User Manual
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865.         PROBLEMS WITH QRT
  866.         
  867.         There are several limitations in this version of QRT:
  868.         
  869.             o  Patterning  does  not   work   well  with  some  quadratic
  870.                surfaces.  This is  a  problem  with  the 3d to 2d mapping
  871.                function used for quadratics.
  872.         
  873.             o  Patterns  do  not   support   circular  or  non-orthogonal
  874.                rectangular   sub-patterns.   This   would   slow  pattern
  875.                processing        but increase the utility of patterns.
  876.         
  877.             o  User defined texturing is not implemented - all objects in
  878.                QRT appear  smooth.   I  have  some  ideas  on  how to add
  879.                textures to objects, but  these  have  not been tested and
  880.                are not incorporated into this version of QRT.
  881.         
  882.             o  Some rounded objects such as  spheres  appear distorted if
  883.                they are near the edge of the image.  This is a bug in the
  884.                routine that creates a ray for a given pixel position.
  885.         
  886.         
  887.         
  888.         FUTURE ENHANCEMENTS TO QRT
  889.         
  890.         The following are some things I'd like to add to QRT:
  891.         
  892.             o  Enhanced  patterning   capability.    This  could  include
  893.                arbitrary polygonal  patterns,  and non-orthogonal shapes.
  894.                Also, the ability to use enumerated  (bit-mapped) patterns
  895.                as well as analytic patterns would be useful.
  896.         
  897.             o  Anti-dithering   routines.     These  routines   are  very
  898.                computationally   expensive   (they   can  increase  image
  899.                generation times by a factor of  3 to 5), so they were not
  900.                included in this version.
  901.         
  902.             o  Penumbral shadows.   This  is  also  very  computationally
  903.                expensive for a minimal utility  level, so I didn't bother
  904.                to include this feature.
  905.         
  906.             o  Fractal generation.  Fractals are,  again, computationally
  907.                expensive, but some things,  such  as mountains, cannot be
  908.                modeled with a ray tracer any other way.
  909.         
  910.             o  Wavy surfaces.  This is useful for modeling water, rippled
  911.                mirrors, etc.  I know  how  to  do  it, I just didn't have
  912.                time to add it yet.  It  would  be  nice if the waves were
  913.                user definable in amplitude and  x and y wavelength.  Wavy
  914.                surfaces are very similar in implementation to textures.
  915.         
  916.  
  917.  
  918.         QRT Ray Tracer               Page 14                  User Manual
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.             o  Snowy surfaces.  This is an idea from DBW, which adds snow
  932.                to a surface depending on its slope and altitude.
  933.         
  934.             o  Interpolated  normal  surfaces.   This  is  a mechanism to
  935.                model  arbitrary  curved  surfaces  by  using  a polygonal
  936.                approximation to the surface, and interpolating the normal
  937.                vector between surfaces to avoid angular looking surfaces.
  938.         
  939.             o  Image  plane  object  lists.    This  is  a  technique for
  940.                increasing the speed for positive line/object intersection
  941.                test.  (Bounding  boxes   increase   speed   for  negative
  942.                line/object intersection tests). 
  943.         
  944.             o  Heuristics for  faster  completion  of  images  using area
  945.                coherence.
  946.         
  947.             o  An  interactive  editor.   This  is  another  large  scale
  948.                project in itself, and I can't forsee having time to do it
  949.                for a long time, but it would be useful.  The editor would
  950.                display a preliminary  image  of  the  scene, and when the
  951.                user had placed objects  to  his  satisfaction,  it  would
  952.                write a QRT input file and call  QRT as a background task.
  953.                There are certain problems here - for instance, how do you
  954.                quickly generate the outline  of  a user defined quadratic
  955.                that can take many forms  (cone,  spheroid, etc)?  And how
  956.                can the user  easily  specify  the  object  tree structure
  957.                (bounding boxes) with an interactive editor?
  958.         
  959.  
  960.  
  961.  
  962.  
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.         QRT Ray Tracer               Page 15                  User Manual
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.